home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.3 (Developer)…68k, x86, SPARC, PA-RISC] / NeXTSTEP 3.3 Dev Intel.iso / NextDeveloper / Headers / remote / NXConnection.h next >
Text File  |  1992-12-16  |  3KB  |  108 lines

  1. /*  NXConnection.h
  2.     Copyright 1992, NeXT, Inc.
  3. */
  4.  
  5. #import <stdlib.h>
  6. #import <stdarg.h>
  7. #import <objc/hashtable.h>
  8. #import <objc/Protocol.h>
  9. #import <objc/List.h>
  10. #import <machkit/NXLock.h>
  11. #import <remote/transport.h>
  12. #import <machkit/NXInvalidationNotifier.h>
  13.  
  14. @class NXProxy;
  15. @class NXPort;
  16.  
  17. /*****************  NXConnection    **************************/
  18.  
  19. /* A connection object is a bookkeeper for objects vended or received over a particular portal (channel) resource.  It may be shared by multiple threads. */
  20.  
  21. @interface NXConnection: NXInvalidationNotifier <NXSenderIsInvalid> {
  22.     id  delegate;
  23. @private
  24.     id  inPortal;   // portal that we decode from
  25.     void *inMachPort;
  26.     id  outPortal;  // portal that we encode to
  27.     void *outMachPort;
  28.     id                  rootObject; // the "default" object for this connection
  29.     unsigned            msgcount;   // how many objc messages sent
  30.     void                *localProxies;
  31.     void                *remoteProxies;
  32.     int                 inTimeout;
  33.     int                 outTimeout;
  34.     NXZone              *zone;
  35.     id                  bufferClass;
  36. }
  37.  
  38. + (NXProxy *) connectToName:(const char *)n;
  39. + (NXProxy *) connectToName:(const char *)n onHost:(const char *)h;
  40. + (NXProxy *) connectToPort:(NXPort *)p;    // allocate a inPort (reply port)
  41. + (NXProxy *) connectToPort:(NXPort *)aPort withInPort:(NXPort *)inPort;
  42.  
  43. + (NXProxy *) connectToName:(const char *)n fromZone:(NXZone *) z;
  44. + (NXProxy *) connectToName:(const char *)n onHost:(const char *)h fromZone:(NXZone *) z;
  45. + (NXProxy *) connectToPort:(NXPort *)p fromZone:(NXZone *) z;
  46. + (NXProxy *) connectToPort:(NXPort *)aPort withInPort:(NXPort *)inPort fromZone:(NXZone *) z;
  47.  
  48. + registerRoot:anObject;    // returns an NXConnection
  49. + registerRoot:anObject withName:(const char *)n;   // returns an NXConnection
  50.  
  51. + registerRoot:anObject fromZone:(NXZone *) z;
  52. + registerRoot:anObject withName:(const char *)n fromZone:(NXZone *) z;
  53.  
  54. + removeObject:anObject;
  55. + unregisterForInvalidationNotification:anObject;
  56.  
  57. + (int)messagesReceived;
  58.  
  59. + connections:(List *) l;   // append existing connections to list
  60.  
  61. + setDefaultTimeout:(int) t;
  62. + (int) defaultTimeout;
  63.  
  64. + setDefaultZone: (NXZone *) zone;
  65. + (NXZone *) defaultZone;
  66.  
  67. // a delegate, if present, will be asked:
  68. //  - connection: (NXConnection *)oldConn didConnect:(NXConnection *)newConn;
  69. - setDelegate:anObject;
  70. - delegate;
  71.  
  72. - setRoot:anObject;    // useful for connections without roots
  73.  
  74. - setInTimeout:(int) t;
  75. - setOutTimeout:(int) t;
  76. - (int) inTimeout;
  77. - (int) outTimeout;
  78.  
  79. - (NXPort *) inPort;
  80. - (NXPort *) outPort;
  81.  
  82. - rootObject;
  83.  
  84. - newRemote:(unsigned)name withProtocol:(Protocol *)p;
  85.  
  86. - (List *)remoteObjects;    // the remote objects imported
  87. - (List *)localObjects;     // the local objects exported
  88.  
  89. - getLocal:anId;        // return the Proxy for a local id
  90.  
  91. - run;                  // blocks
  92. - runWithTimeout:(int) t;
  93. - runInNewThread;       // spawns thread, thread will "run"; nonblocking
  94.  
  95. - free;
  96. @end
  97.  
  98.  
  99. // By special request, a convenient interface for AppKit programmers
  100. @interface NXConnection (NXAppKitServer) 
  101. - runFromAppKit;    // nonblocking
  102. @end
  103.  
  104. // definitions
  105.  
  106. // timeout is specified in milliseconds
  107. #define NX_CONNECTION_DEFAULT_TIMEOUT   15000
  108.